#ifndef MUSICJSONPARSER_H
#define MUSICJSONPARSER_H

#include <QJsonObject>
#include <QList>
#include <QString>

class SongInfo {
public:
    // 默认构造函数
    SongInfo() = default;
    
    // 带参数的构造函数
    SongInfo(QString id, const QString& name, const QString& artist, 
             const QString& album, int duration, int fee)
        : m_id(id), m_name(name), m_artist(artist),
        m_album(album), m_duration(duration), m_fee(fee) {}
    
    // Getter方法
    QString id() const { return m_id; }
    QString name() const { return m_name; }
    QString artist() const { return m_artist; }
    QString album() const { return m_album; }
    int duration() const { return m_duration; }
    int fee() const { return m_fee; }
    
    // Setter方法（如果需要修改属性）
    void setId(QString id) { m_id = id; }
    void setName(const QString& name) { m_name = name; }
    void setArtist(const QString& artist) { m_artist = artist; }
    void setAlbum(const QString& album) { m_album = album; }
    void setDuration(int duration) { m_duration = duration; }
    void setFee(int fee) { m_fee = fee; }
    
private:
    QString m_id;
    QString m_name;
    QString m_artist;
    QString m_album;
    int m_duration;
    int m_fee;
};

class MusicJsonParser
{
public:
    // 解析音乐JSON数据并返回筛选后的歌曲列表
    static QList<SongInfo> parseMusicJson(const QJsonObject &jsonObject, bool &success);
};

#endif // MUSICJSONPARSER_H
